package com.deer.wms.base.system.web;

import com.deer.wms.base.system.model.erp.ErpOutTask;
import com.deer.wms.base.system.model.erp.ReturnGoods;
import com.deer.wms.base.system.model.erp.ErpTask;
import com.deer.wms.base.system.service.ErpService;
import com.deer.wms.project.root.core.result.Result;
import com.deer.wms.project.root.core.result.ResultGenerator;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/erpBack")
public class ErpBackRecodeController {

    @Autowired
    private ErpService erpService;

//    @Autowired
//    private ErpBackRecordService erpBackRecordService;

//    @ApiOperation(value = "查询erp回传记录", notes = "查询erp回传记录")
////    @GetMapping("/selectList")
////    public Result selectList(Integer type, Integer state, String erpNo, Integer pageNum, Integer pageSize) {
////        PageHelper.startPage(pageNum, pageSize);
////        List<ErpBackRecord> billList = erpBackRecordService.selectList(type,state,erpNo);
////        PageInfo pageInfo = new PageInfo(billList);
////        return ResultGenerator.genSuccessResult(pageInfo);
////    }

    @ApiOperation(value = "删除erp回传记录", notes = "删除erp回传记录")
    @GetMapping("/deletedErpLog")
    public Result deletedErpLog(Integer id) {
//        erpBackRecordService.deleteById(id);
        return ResultGenerator.genSuccessResult();
    }

    //报错（作废）
    @ApiOperation(value = "批量删除erp回传记录", notes = "批量删除erp回传记录")
    @GetMapping("/deletedErpLogByIds")
    public Result deletedErpLogByList(String ids) {
//        erpBackRecordService.deleteByIds(ids);
        return ResultGenerator.genSuccessResult();
    }












    /*@ApiOperation(value = "采购收货回传数据", notes = "采购收货回传数据")
    @PostMapping("/queryErp")
    public Result queryErp(@RequestBody Map<String,Object> hashMap){
        //采购收货回传数据
        return ResultGenerator.genSuccessResult(erpService.queryErp(hashMap));
    }*/

    @ApiOperation(value = "ASN通知单查询接口", notes = "ASN通知单查询接口")
    @PostMapping("/queryAsnNoticeOf")
    public Result queryAsnNoticeOf(@RequestBody Map<String,String> asnNotice){
        //ASN通知单查询接口
        List<ErpTask> asnNotices = erpService.queryAsnNoticeOf(asnNotice);
        return ResultGenerator.genSuccessResult(asnNotices);
    }

    @ApiOperation(value = "采购退货回传接口", notes = "采购退货回传接口")
    @PostMapping("/purchaseReturn")
    public Result purchaseReturn(@RequestBody Map<String,Object> purchase){
        //采购退货回传接口
        Map<String,Object> map = erpService.purchaseReturn(purchase);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "采购退货通知单接口", notes = "采购退货通知单接口")
    @PostMapping("/purchaseReturnNotice")
    public Result purchaseReturnNotice(@RequestBody Map<String,Object> purchase){
        //采购退货通知单接口
        List<ErpOutTask> map = erpService.purchaseReturnNotice(purchase);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "销售出货回传接口", notes = "销售出货回传接口")
    @PostMapping("/salesShipment")
    public Result salesShipment(@RequestBody Map<String,Object> hashMap){
        //销售出货回传接口
        Map<String,Object> map = erpService.salesShipment(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "销售出货查询接口", notes = "销售出货查询接口")
    @PostMapping("/salesShipmentQuery")
    public Result salesShipmentQuery(@RequestBody Map<String,Object> hashMap){
        //销售出货查询接口
        List<ErpOutTask> map = erpService.salesShipmentQuery(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "销售退货回传接口", notes = "销售退货回传接口")
    @PostMapping("/salesReturn")
    public Result salesReturn(@RequestBody Map<String,Object> hashMap){
        //销售退货回传接口
        Map<String,Object> map = erpService.salesReturn(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "销售退货申请单接口", notes = "销售退货申请单接口")
    @PostMapping("/salesReturnApplication")
    public Result salesReturnApplication(@RequestBody Map<String,Object> hashMap){
        //销售退货申请单接口
        List<ErpTask> billList = erpService.salesReturnApplication(hashMap);
        return ResultGenerator.genSuccessResult(billList);
    }

    @ApiOperation(value = "生产领料回传接口", notes = "生产领料回传接口")
    @PostMapping("/productionOfPicking")
    public Result productionOfPicking(@RequestBody Map<String,Object> hashMap){
        //生产领料回传接口
        Map<String,Object> map = erpService.productionOfPicking(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "生产领料申请单接口", notes = "生产领料申请单接口")
    @PostMapping("/productionOfPickingApplication")
    public Result productionOfPickingApplication(@RequestBody Map<String,Object> hashMap){
        //生产领料申请单接口
        List<ErpOutTask> map = erpService.productionOfPickingApplication(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "生产退料回传接口", notes = "生产退料回传接口")
    @PostMapping("/productionMaterialReturn")
    public Result productionMaterialReturn(@RequestBody Map<String,Object> hashMap){
        //生产退料回传接口
        Map<String,Object> map = erpService.productionMaterialReturn(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "生产退料申请单接口", notes = "生产退料申请单接口")
    @PostMapping("/productionMaterialReturnApplication")
    public Result productionMaterialReturnApplication(@RequestBody Map<String,Object> hashMap){
        //生产退料申请单接口
        List<ErpTask> erpTasks = erpService.productionMaterialReturnApplication(hashMap);
        return ResultGenerator.genSuccessResult(erpTasks);
    }

    @ApiOperation(value = "完工报告回传接口", notes = "完工报告回传接口")
    @PostMapping("/completionOfTheReport")
    public Result completionOfTheReport(@RequestBody Map<String,Object> hashMap){
        //完工报告回传接口
        Map<String,Object> map = erpService.completionOfTheReport(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "完工报告生产订单接口", notes = "完工报告生产订单接口")
    @PostMapping("/completionOfTheReportApplication")
    public Result completionOfTheReportApplication(@RequestBody Map<String,Object> hashMap){
        //完工报告生产订单接口
        List<ErpTask> map = erpService.completionOfTheReportApplication(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "调拨出库*委外发科回传接口", notes = "调拨出库*委外发科回传接口")
    @PostMapping("/inAllocatingOutbound")
    public Result inAllocatingOutbound(@RequestBody Map<String,Object> hashMap){
        //调拨出库*委外发科回传接口
        Map<String,Object> map = erpService.inAllocatingOutbound(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }


    @ApiOperation(value = "调拨出库*委外发科申请单接口", notes = "调拨出库*委外发科申请单接口")
    @PostMapping("/inAllocatingOutboundApplication")
    public Result inAllocatingOutboundApplication(@RequestBody Map<String,Object> hashMap){
        //调拨出库*委外发科申请单接口
        List<ErpOutTask> map = erpService.inAllocatingOutboundApplication(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }


    @ApiOperation(value = "杂收单回传接口", notes = "杂收单回传接口")
    @PostMapping("/miscellaneousChargeSheet")
    public Result miscellaneousChargeSheet(@RequestBody Map<String,Object> hashMap){
        //杂收单回传接口
        Map<String,Object> map = erpService.miscellaneousChargeSheet(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }

    @ApiOperation(value = "杂发单回传接口", notes = "杂发单回传接口")
    @PostMapping("/miscellaneous")
    public Result miscellaneous(@RequestBody Map<String,Object> hashMap){
        //杂发单回传接口
        Map<String,Object> map = erpService.miscellaneous(hashMap);
        return ResultGenerator.genSuccessResult(map);
    }









}
